# 删除旧文件
echo 'Step 1: delete old repo and clone new one'
cd /d/temp
rm -rf /d/temp/PSI

# clone PSI
git clone https://gitee.com/crm8000/PSI.git

# 构建Help
echo 'Step 2: building PSI Help'
cd /d/temp/PSI/doc/help_src_v2
npm install 
npm run build

# 复制Help文件到PSI主目录
rm -rf /d/temp/PSI/help
mkdir /d/temp/PSI/help
cp -r /d/temp/PSI/doc/help_src_v2/docs/.vuepress/dist/* /d/temp/PSI/help


# 构建移动端
echo 'Step 3: building PSI Mobile'
cd /d/temp/PSI/mobile_src
npm install 
npm run build

# 复制移动端构建文件到PSI主目录
mkdir /d/temp/PSI/mobile
cp -r /d/temp/PSI/mobile_src/dist/* /d/temp/PSI/mobile

# 删除不用发布的文件
rm -rf /d/temp/PSI/doc
rm -rf /d/temp/PSI/mobile_src
rm -rf /d/temp/PSI/.git
rm -rf /d/temp/PSI/.editorconfig
rm -rf /d/temp/PSI/.gitignore
rm -rf /d/temp/PSI/README.md
rm -rf /d/temp/PSI/license_files
rm -rf /d/temp/PSI/LICENSE

read -t 10 -p "Done! Have fun!"
